import request from '@/utils/request'
import {pramsToQuery} from '@/utils/index'

// 获取考勤配置
export function getAtteConfig(data) {
  return request({
    url: `/atte/config`,
    method: 'get',
    data
  })
}
// 保存考勤配置
export function putAtteConfig(data) {
  return request({
    url: '/atte/config',
    method: 'put',
    data
  })
}
// 考勤列表
export function getAttendanceList(data) {
  return request({
    url: `/atte/members?${pramsToQuery(data)}`,
    method: 'get',
    data
  })
}
// 考勤详情
export function getAttendanceDetails(data) {
  return request({
    url: `/atte/members/${data.userId}/${data.attendDate}?${pramsToQuery(data)}`,
    method: 'get',
    data
  })
}
// 考勤组列表
export function getAattendGroupLils(data) {
  return request({
    url: `/atte/attendGroup?${pramsToQuery(data)}`,
    method: 'get',
    data
  })
}
// 添加考勤组
export function addAttendGroup(data) {
  return request({
    url: `/atte/attendGroup`,
    method: 'post',
    data
  })
}
// 获取考勤组信息
export function getAttendGroupInfo(data) {
  return request({
    url: `/atte/attendGroup/${data.id}?${pramsToQuery(data)}`,
    method: 'get',
    data
  })
}
// 更新考勤组信息
export function putAttendGroupInfo(data) {
  return request({
    url: `/atte/attendGroup/${data.id}`,
    method: 'put',
    data
  })
}
// 删除考勤组
export function delAttendGroupInfo(data) {
  return request({
    url: `/atte/attendGroup/${data.id}`,
    method: 'delete',
    data
  })
}
// 加班规则列表
export function getRuleOvertimeList(data) {
  return request({
    url: `/atte/rule/overtime?${pramsToQuery(data)}`,
    method: 'get',
    data
  })
}
// 添加加班规则
export function addRuleOvertimeList(data) {
  return request({
    url: `/atte/rule/overtime`,
    method: 'post',
    data
  })
}
// 更新加班规则
export function putRuleOvertimeList(data) {
  return request({
    url: `/atte/rule/overtime/${data.id}`,
    method: 'put',
    data
  })
}
// 获取加班规则信息
export function getRuleOvertimeInfo(data) {
  return request({
    url: `/atte/rule/overtime/${data.id}?${pramsToQuery(data)}`,
    method: 'get',
    data
  })
}
// 删除加班规则
export function delRuleOvertime(data) {
  return request({
    url: `/atte/rule/overtime/${data.id}`,
    method: 'delete',
    data
  })
}
// 补卡规则列表
export function getRuleMakeupList(data) {
  return request({
    url: `/atte/rule/makeup?${pramsToQuery(data)}`,
    method: 'get',
    data
  })
}
// 更新补卡规则
export function addRuleMakeup(data) {
  return request({
    url: `/atte/rule/makeup/${data.id}`,
    method: 'put',
    data
  })
}
// 删除补卡规则
export function delRuleMakeup(data) {
  return request({
    url: `/atte/rule/makeup/${data.id}`,
    method: 'delete',
    data
  })
}
// 假期规则列表
export function getRuleHolidayList(data) {
  return request({
    url: `/atte/rule/holiday?${pramsToQuery(data)}`,
    method: 'get',
    data
  })
}
// 添加假期规则
export function addRuleHoliday(data) {
  return request({
    url: `/atte/rule/holiday`,
    method: 'post',
    data
  })
}
// 更新假期规则
export function putRuleHoliday(data) {
  return request({
    url: `/atte/rule/holiday/${data.id}`,
    method: 'put',
    data
  })
}
// 删除假期规则
export function delRuleHoliday(data) {
  return request({
    url: `/atte/rule/holiday/${data.id}`,
    method: 'delete',
    data
  })
}
// 添加假期司龄规则
export function addRuleServiceTime(data) {
  return request({
    url: `/atte/rule/holiday/serviceTime`,
    method: 'post',
    data
  })
}
// 更新假期司龄规则
export function putRuleServiceTime(data) {
  return request({
    url: `/atte/rule/holiday/serviceTime/${data.id}`,
    method: 'put',
    data
  })
}
// 删除假期司龄规则
export function delRuleServiceTime(data) {
  return request({
    url: `/atte/rule/holiday/serviceTime/${data.id}`,
    method: 'delete',
    data
  })
}
// 删除假期司龄规则
export function signExoprt(data) {
  return request({
    url: `/atte/export?${pramsToQuery(data)}`,
    method: 'get',
    responseType:'blob',
    data
  })
}

